#ifndef __DEF_PTRANDIALOG_H__
#define __DEF_PTRANDIALOG_H__

#include <wx/wx.h>
#include <wx/listctrl.h>
#include "appconstant.h"
#include "dbkakeibo.h"
#include "ipt_dialog.h"


class PeriodicalTranDialog: public wxDialog
{
public:
	PeriodicalTranDialog(wxWindow *parent);
	~PeriodicalTranDialog(void)
	{
		ipt_dialog->Close();
	}
	void BindData_Periodical(DBL_periodical &db);
	DBL_periodical &GetData_Periodical(void);
protected:
	wxPanel *pt_mainPanel;
		wxListCtrl *pt_PeriodicalList;
		wxButton *pt_AddPeriodic;
		wxButton *pt_ModPeriodic;
		wxButton *pt_DelPeriodic;
	
	Input_PTranDialog *ipt_dialog;

	wxButton *pt_OkBtn;
	wxButton *pt_CanBtn;
	void pt_OkBtn_clicked(wxCommandEvent &event);
	void pt_CanBtn_clicked(wxCommandEvent &event);
	void pt_AddPeriodic_clicked(wxCommandEvent &event);
	void pt_ModPeriodic_clicked(wxCommandEvent &event);
	void pt_DelPeriodic_clicked(wxCommandEvent &event);
	void pt_PeriodicalList_selected(wxListEvent &event);

private:
	void InsertRow(wxListCtrl *lstcrtl, wxString list[], size_t size);
	void ChangeRow(wxListCtrl *lstcrtl, int index, wxString list[], size_t size);
	void DeleteRow(wxListCtrl *lstcrtl, int index);
	wxString GetTimingString(int index);
private:
	DECLARE_EVENT_TABLE()
	DBL_periodical dbperiod;
	int listselect;
};


enum {
	periodicaltran_ok = 150,
	periodicaltran_can,
	periodicaltran_add,
	periodicaltran_mod,
	periodicaltran_del,
	periodicaltran_periolist
};
#endif